home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / c / cxref_1_4a.lha / cpp / cccp.c.diff < prev    next >
Text File  |  1997-07-05  |  5KB  |  162 lines

  1. *** cccp.c    1997/04/25 18:13:41    1.1
  2. --- cccp.c    1997/05/26 15:11:14    1.4
  3. ***************
  4. *** 3,8 ****
  5. --- 3,12 ----
  6.      Written by Paul Rubin, June 1986
  7.      Adapted to ANSI C, Richard Stallman, Jan 1987
  8.   
  9. +    Modified by Andrew M. Bishop to provide better input to
  10. +    C documentation program `cxref' 1995,1996.
  11. +    All AMB hacks are indicated as such in the code (grep AMB).
  12.   This program is free software; you can redistribute it and/or modify it
  13.   under the terms of the GNU General Public License as published by the
  14.   Free Software Foundation; either version 2, or (at your option) any
  15. ***************
  16. *** 406,411 ****
  17. --- 410,425 ----
  18.   static enum {dump_none, dump_only, dump_names, dump_definitions}
  19.        dump_macros = dump_none;
  20.   
  21. + /* Start new option added by AMB */
  22. + /* Nonzero means that the #include lines are to be passed through to
  23. +    output.
  24. + */
  25. + static int dump_includes = 0;
  26. + /* End new option added by AMB */
  27.   /* Nonzero means pass all #define and #undef directives which we actually
  28.      process through to the output stream.  This feature is used primarily
  29.      to allow cc1 to record the #defines and #undefs for the sake of
  30. ***************
  31. *** 964,970 ****
  32.   /* Here is the actual list of #-directives, most-often-used first.  */
  33.   
  34.   static struct directive directive_table[] = {
  35. !   {  6, do_define, "define", T_DEFINE, 0, 1},
  36.     {  2, do_if, "if", T_IF},
  37.     {  5, do_xifdef, "ifdef", T_IFDEF},
  38.     {  6, do_xifdef, "ifndef", T_IFNDEF},
  39. --- 978,984 ----
  40.   /* Here is the actual list of #-directives, most-often-used first.  */
  41.   
  42.   static struct directive directive_table[] = {
  43. !   {  6, do_define, "define", T_DEFINE, 0, 1, 1}, /* The last 1 is in future cccp.c added by AMB. */
  44.     {  2, do_if, "if", T_IF},
  45.     {  5, do_xifdef, "ifdef", T_IFDEF},
  46.     {  6, do_xifdef, "ifndef", T_IFNDEF},
  47. ***************
  48. *** 1355,1360 ****
  49. --- 1369,1377 ----
  50.     no_line_directives = 0;
  51.     no_trigraphs = 1;
  52.     dump_macros = dump_none;
  53. + /* Start new option added by AMB */
  54. +   dump_includes = 0;
  55. + /* End new option added by AMB */
  56.     no_output = 0;
  57.     cplusplus = 0;
  58.     cplusplus_comments = 1;
  59. ***************
  60. *** 1666,1671 ****
  61. --- 1683,1693 ----
  62.           case 'D':
  63.             dump_macros = dump_definitions;
  64.             break;
  65. + /* Start new option added by AMB */
  66. +         case 'I':
  67. +           dump_includes = 1;
  68. +           break;
  69. + /* End new option added by AMB */
  70.           }
  71.         }
  72.       }
  73. ***************
  74. *** 3841,3850 ****
  75.           bp = ip->bufp;
  76.           /* No need to copy the directive because of a comment at the end;
  77.              just don't include the comment in the directive.  */
  78. !         if (bp == limit || *bp == '\n') {
  79. !           bp = obp;
  80. !           goto endloop1;
  81.           }
  82.           /* Don't remove the comments if -traditional.  */
  83.           if (! keep_comments)
  84.             copy_directive++;
  85. --- 3863,3879 ----
  86.           bp = ip->bufp;
  87.           /* No need to copy the directive because of a comment at the end;
  88.              just don't include the comment in the directive.  */
  89. ! /* Start of code from future cccp.c added by AMB */
  90. !         if (!put_out_comments) {
  91. !           U_CHAR *p;
  92. !           for (p = bp;  *p == ' ' || *p == '\t';  p++)
  93. !         continue;
  94. !           if (*p == '\n') {
  95. !         bp = obp;
  96. !         goto endloop1;
  97. !           }
  98.           }
  99. + /* End of code from future cccp.c added by AMB */
  100.           /* Don't remove the comments if -traditional.  */
  101.           if (! keep_comments)
  102.             copy_directive++;
  103. ***************
  104. *** 3874,3880 ****
  105.   
  106.         /* If a directive should be copied through, and -E was given,
  107.        pass it through before removing comments.  */
  108. !       if (!no_output && kt->pass_thru && put_out_comments) {
  109.           int len;
  110.   
  111.       /* Output directive name.  */
  112. --- 3903,3912 ----
  113.   
  114.         /* If a directive should be copied through, and -E was given,
  115.        pass it through before removing comments.  */
  116. !       if (!no_output && put_out_comments &&
  117. ! /* Start new option added by AMB */
  118. !           (kt->pass_thru || (kt->type == T_INCLUDE && dump_includes))) {
  119. ! /* End new option added by AMB */
  120.           int len;
  121.   
  122.       /* Output directive name.  */
  123. ***************
  124. *** 4002,4007 ****
  125. --- 4034,4043 ----
  126.   
  127.         if (!no_output && already_output == 0
  128.         && (kt->pass_thru
  129. + /* Start new option added by AMB */
  130. +           || (kt->type == T_INCLUDE
  131. +           && dump_includes)
  132. + /* End new option added by AMB */
  133.             || (kt->type == T_DEFINE
  134.             && (dump_macros == dump_names
  135.                 || dump_macros == dump_definitions)))) {
  136. ***************
  137. *** 4013,4019 ****
  138.           bcopy (kt->name, (char *) op->bufp, kt->length);
  139.           op->bufp += kt->length;
  140.   
  141. !     if (kt->pass_thru || dump_macros == dump_definitions) {
  142.         /* Output arguments.  */
  143.         len = (cp - buf);
  144.         check_expand (op, len);
  145. --- 4049,4059 ----
  146.           bcopy (kt->name, (char *) op->bufp, kt->length);
  147.           op->bufp += kt->length;
  148.   
  149. !     if (kt->pass_thru || dump_macros == dump_definitions
  150. ! /* Start new option added by AMB */
  151. !           || dump_includes
  152. ! /* End new option added by AMB */
  153. !             ) {
  154.         /* Output arguments.  */
  155.         len = (cp - buf);
  156.         check_expand (op, len);
  157.